*========================================================================*

/*----------------------------------------------------*
       Project : Covid 19
       Purpose : Supplementary Table S16
       Updated : September 29, 2021
*-----------------------------------------------------*/

*=======================================================================*
** SETTING UP
version 15
clear all
pause on
set more off
qui cap log c

set scheme plotplain


loc path_LM = "/Users/louis-maeljean/Dropbox (MIT)/West Bengal Information Campaign/AER_I/for_submission"
loc path = "`path_LM'" 		//other users should change this

cd "`path'"


*========================================================================*

/*PLEASE READ:

In this file appendix tables S2-S3, S19,S21 and S25-S26 for the GP Survey 
are implemented. Note that other GP related appendix tables are implemented in R-files.

---- !
Please note that Table S26 takes much longer to run as we compute empirical power
by performing simulations.
---- !

In Table S19, we run three sets of regressions for each outcome:
	1. Pooled
	2. Only Jio Users
	3. Only Non-Jio Users


DEFINITIONS FOR EACH OF THE VARIABLES USED BELOW:
	1. travel_own  =  Whether the respondent traveled outside own village in the past 2 days (its a binary : 1 or 0)
	2. W2total_interactions_vill  =  Total Interaction in past two days (summing within village, vill-vill, vill-town and vill-city) - winsorized top 5%
	3. resp_mask_wear  =  Does the respondent wear a mask or cover face when leaving house (its a binary : 1 or 0 ).
  4. comm_mask_rate  = Respondent's answer to: Out of 100 people in your village, how many people are wearing masks?
	5. typical_handwash  =  If someone in their village comes back home 10 times a day, then out of 10 times how many times do they wash their hands with soap.
	6. W2ever_talk  =  Per day count of how many people did the respondent give or get info/advise about COVID19  - winsorized top 5%
	7. net_knowledge =  ( (#right symptoms + #right precautions) - (#wrong symptoms + #wrong precautions )  note : read '#' as 'number of'.


We use the following FE and controls throughout:
	1. district FE = District respondent lived in
	2. id_date FE  = Survey date (survey lasted for a total of 9 days)
	3. jio_yn      = Does respondent or someone in their HH have a jio cellular connection
	4. resp_age    = Age of the respondent
	5. resp_gender = Gender of the respondent
	6. smartphone  = Does the respondent or someone in their HH have a smartphone

Finally, throughout all the regressions we cluster standard errors at the PIN code level.

*/




** LOADING PROCESSED DATASET **
use "`path'/data/outcomes_reg_input.dta", clear 


label var TrtXjio "Treat(Jio) = Treat(Non-Jio)"
label var resp_gender "Repondent Gender Female"

*==================================================================================================================================
                    *Not Published| Balance among those who provide JIO info vs those who don't *
*==================================================================================================================================

preserve
gen missing_jio = missing(jio_self_yn)


iebaltab resp_age resp_gender smartphone gp_member, grpvar(missing_jio) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Jio info @ 1 No Jio info") ///
savetex("`path'/output/Tables/Balance_jio_noJio_info.tex") replace


restore



*=======================================================================================================================================*
					* SUPPLEMENTARY TABLE A7| Test for the Equality of Treatment Effect across all pairs of Message Content*
*=======================================================================================================================================*

/*PLEASE READ:

In this section Table S21 is implemented. We perfom an F-test for the equality of Treatment Effect across all 
pairs of message content

*/

clear all
use "`path'/data/outcomes_reg_input.dta", clear 

local controls smartphone resp_age resp_gender  //controls used throughout the regressions
local FE i.district i.id_date i.jio_yn 			//FE used throughout the regressions

label var Type1 "NO"
label var Type2 "Neut"

//Define three subsamples used for the analysis
local jio jio_yn==1 
local non_jio jio_yn==0
local pooled jio_yn==1|jio_yn==0

qui count if `pooled'
local Npooled = r(N)
qui count if `jio'
local Njio = r(N)
qui count if `non_jio'
local Nnon_jio = r(N)
foreach subsample in `pooled' `jio' `non_jio'{
	
	preserve 
	rename (travel_own W2total_interactions_vill typical_handwash resp_mask_wear W2ever_talk net_knowledge) (Travel Total_Interactions Handwash Mask_Use Conversations Knowledge_Index) //for coding simplicity
	keep if `subsample'
	quietly count
	if r(N) ==  `Npooled' { 			//i.e. if total sample
		loc M = "Mpooled"

	}
	
	else if r(N) ==  `Njio'{		//i.e. if jio sample
		loc M = "Mjio"
	}
	
	else if r(N) ==  `Nnon_jio'{		//i.e. if non_jio sample
		loc M = "Mnon_jio"
	}
	
	
	************ RUNNING THE REGRESSIONS **************
	foreach var in Travel Total_Interactions Handwash Mask_Use Conversations Knowledge_Index{
		
		qui reg `var' SD Hyg  `FE' `controls'
		estimates store `var'1
		
		qui reg `var' Ext Int  `FE' `controls'
		estimates store `var'2

		qui reg `var' Type1 Type2 `FE' `controls'
		estimates store `var'3
	
	}
	

	loc obs = e(N)

	//Seemingly Unrelated Regessions to perform cross-regressional tests
	qui suest Travel1 Total_Interactions1 Handwash1  Mask_Use1 Conversations1 Knowledge_Index1 Travel2 Total_Interactions2 Handwash2  Mask_Use2 Conversations2 Knowledge_Index2 Travel3 Total_Interactions3 Handwash3  Mask_Use3 Conversations3 Knowledge_Index3, vce(cluster pincode)


		************** PERFORM TESTS FOR ALL 15 COMBINATIONS ****************

		//SD == Hyg
		test (_b[Travel1_mean:SD] = _b[Travel1_mean:Hyg])  (_b[Total_Interactions1_mean:SD] = _b[Total_Interactions1_mean:Hyg])  (_b[Handwash1_mean:SD] = _b[Handwash1_mean:Hyg]) (_b[Mask_Use1_mean:SD] = _b[Mask_Use1_mean:Hyg]) (_b[Conversations1_mean:SD] = _b[Conversations1_mean:Hyg]) (_b[Knowledge_Index1_mean:SD] = _b[Knowledge_Index1_mean:Hyg])  
		loc SDHyg = r(chi2)
		loc p_SDHyg = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 1							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 1			

		mat `M' = (`F_stat',`Fp_val') //store results in the corresponding matrix


		//SD == Ext
		test (_b[Travel1_mean:SD] = _b[Travel2_mean:Ext])  (_b[Total_Interactions1_mean:SD] = _b[Total_Interactions2_mean:Ext])  (_b[Handwash1_mean:SD] = _b[Handwash2_mean:Ext]) (_b[Mask_Use1_mean:SD] = _b[Mask_Use2_mean:Ext]) (_b[Conversations1_mean:SD] = _b[Conversations2_mean:Ext]) (_b[Knowledge_Index1_mean:SD] = _b[Knowledge_Index2_mean:Ext])
		loc SDExt = r(chi2)
		loc p_SDExt = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 2							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 2

		mat `M' = (`M' \ `F_stat',`Fp_val')

		//SD == Int
		test (_b[Travel1_mean:SD] = _b[Travel2_mean:Int])  (_b[Total_Interactions1_mean:SD] = _b[Total_Interactions2_mean:Int])  (_b[Handwash1_mean:SD] = _b[Handwash2_mean:Int]) (_b[Mask_Use1_mean:SD] = _b[Mask_Use2_mean:Int]) (_b[Conversations1_mean:SD] = _b[Conversations2_mean:Int]) (_b[Knowledge_Index1_mean:SD] = _b[Knowledge_Index2_mean:Int])
		loc SDInt = r(chi2)
		loc p_SDInt = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 3							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 3

					
		mat `M' = (`M' \ `F_stat',`Fp_val')


		//SD == No
		test (_b[Travel1_mean:SD] = _b[Travel3_mean:Type1])  (_b[Total_Interactions1_mean:SD] = _b[Total_Interactions3_mean:Type1])  (_b[Handwash1_mean:SD] = _b[Handwash3_mean:Type1]) (_b[Mask_Use1_mean:SD] = _b[Mask_Use3_mean:Type1]) (_b[Conversations1_mean:SD] = _b[Conversations3_mean:Type1]) (_b[Knowledge_Index1_mean:SD] = _b[Knowledge_Index3_mean:Type1])
		loc SDNo = r(chi2)
		loc p_SDNo = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 4							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 4

					
		mat `M' = (`M' \ `F_stat',`Fp_val')


		//SD == Neut
		test (_b[Travel1_mean:SD] = _b[Travel3_mean:Type2])  (_b[Total_Interactions1_mean:SD] = _b[Total_Interactions3_mean:Type2])  (_b[Handwash1_mean:SD] = _b[Handwash3_mean:Type2]) (_b[Mask_Use1_mean:SD] = _b[Mask_Use3_mean:Type2]) (_b[Conversations1_mean:SD] = _b[Conversations3_mean:Type2]) (_b[Knowledge_Index1_mean:SD] = _b[Knowledge_Index3_mean:Type2])
		loc SDNeut = r(chi2)
		loc p_SDNeut = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 5							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 5

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Hyg == Ext
		test (_b[Travel1_mean:Hyg] = _b[Travel2_mean:Ext])  (_b[Total_Interactions1_mean:Hyg] = _b[Total_Interactions2_mean:Ext])  (_b[Handwash1_mean:Hyg] = _b[Handwash2_mean:Ext]) (_b[Mask_Use1_mean:Hyg] =_b[Mask_Use2_mean:Ext] ) ( _b[Conversations1_mean:Hyg] = _b[Conversations2_mean:Ext]) (_b[Knowledge_Index1_mean:Hyg] = _b[Knowledge_Index2_mean:Ext])
		loc HygExt = r(chi2)
		loc p_HygExt = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 6							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 6

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Hyg == Int 
		test (_b[Travel1_mean:Hyg] = _b[Travel2_mean:Int])  (_b[Total_Interactions1_mean:Hyg] = _b[Total_Interactions2_mean:Int])  (_b[Handwash1_mean:Hyg] = _b[Handwash2_mean:Int]) (_b[Mask_Use1_mean:Hyg] =_b[Mask_Use2_mean:Int] ) ( _b[Conversations1_mean:Hyg] = _b[Conversations2_mean:Int]) (_b[Knowledge_Index1_mean:Hyg] = _b[Knowledge_Index2_mean:Int])
		loc HygInt = r(chi2)
		loc p_HygInt = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 7							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 7

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Hyg == No (Type 1)
		test (_b[Travel1_mean:Hyg] = _b[Travel3_mean:Type1])  (_b[Total_Interactions1_mean:Hyg] = _b[Total_Interactions3_mean:Type1])  (_b[Handwash1_mean:Hyg] = _b[Handwash3_mean:Type1]) (_b[Mask_Use1_mean:Hyg] =_b[Mask_Use3_mean:Type1] ) ( _b[Conversations1_mean:Hyg] = _b[Conversations3_mean:Type1]) (_b[Knowledge_Index1_mean:Hyg] = _b[Knowledge_Index3_mean:Type1])
		loc HygNo = r(chi2)
		loc p_HygNo = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 8							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 8

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Hyg == Neut (Type 2)
		test (_b[Travel1_mean:Hyg] = _b[Travel3_mean:Type2])  (_b[Total_Interactions1_mean:Hyg] = _b[Total_Interactions3_mean:Type2])  (_b[Handwash1_mean:Hyg] = _b[Handwash3_mean:Type2]) (_b[Mask_Use1_mean:Hyg] =_b[Mask_Use3_mean:Type2] ) ( _b[Conversations1_mean:Hyg] = _b[Conversations3_mean:Type2]) (_b[Knowledge_Index1_mean:Hyg] = _b[Knowledge_Index3_mean:Type2])
		loc HygNeut = r(chi2)
		loc p_HygNeut = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 9							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 9

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Ext == Int
		test (_b[Travel2_mean:Int] = _b[Travel2_mean:Ext])  (_b[Total_Interactions2_mean:Int] = _b[Total_Interactions2_mean:Ext])  (_b[Handwash2_mean:Int] = _b[Handwash2_mean:Ext]) (_b[Mask_Use2_mean:Int] =_b[Mask_Use2_mean:Ext] ) ( _b[Conversations2_mean:Int] = _b[Conversations2_mean:Ext]) (_b[Knowledge_Index2_mean:Int] = _b[Knowledge_Index2_mean:Ext])
		loc ExtInt = r(chi2)
		loc p_ExtInt = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 10							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 10

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Ext == No
		test (_b[Travel3_mean:Type1] = _b[Travel2_mean:Ext])  (_b[Total_Interactions3_mean:Type1] = _b[Total_Interactions2_mean:Ext])  (_b[Handwash3_mean:Type1] = _b[Handwash2_mean:Ext]) (_b[Mask_Use3_mean:Type1] =_b[Mask_Use2_mean:Ext] ) ( _b[Conversations3_mean:Type1]= _b[Conversations2_mean:Ext]) (_b[Knowledge_Index3_mean:Type1] = _b[Knowledge_Index2_mean:Ext])
		loc ExtNo = r(chi2)
		loc p_ExtNo = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 11						
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 11

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Ext == Neut
		test (_b[Travel3_mean:Type2] = _b[Travel2_mean:Ext])  (_b[Total_Interactions3_mean:Type2] = _b[Total_Interactions2_mean:Ext])  (_b[Handwash3_mean:Type2] = _b[Handwash2_mean:Ext]) (_b[Mask_Use3_mean:Type2] =_b[Mask_Use2_mean:Ext] ) ( _b[Conversations3_mean:Type2]= _b[Conversations2_mean:Ext]) (_b[Knowledge_Index3_mean:Type2] = _b[Knowledge_Index2_mean:Ext])
		loc ExtNeut = r(chi2)
		loc p_ExtNeut = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 12							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 12

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Int == No
		test (_b[Travel3_mean:Type1] = _b[Travel2_mean:Int])  (_b[Total_Interactions3_mean:Type1] = _b[Total_Interactions2_mean:Int])  (_b[Handwash3_mean:Type1] = _b[Handwash2_mean:Int]) (_b[Mask_Use3_mean:Type1] =_b[Mask_Use2_mean:Int] ) ( _b[Conversations3_mean:Type1]= _b[Conversations2_mean:Int]) (_b[Knowledge_Index3_mean:Type1] = _b[Knowledge_Index2_mean:Int])
		loc IntNo = r(chi2)
		loc p_IntNo = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 13							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 13

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//Int == Neut
		test (_b[Travel3_mean:Type2] = _b[Travel2_mean:Int])  (_b[Total_Interactions3_mean:Type2] = _b[Total_Interactions2_mean:Int])  (_b[Handwash3_mean:Type2] = _b[Handwash2_mean:Int]) (_b[Mask_Use3_mean:Type2] =_b[Mask_Use2_mean:Int] ) ( _b[Conversations3_mean:Type2]= _b[Conversations2_mean:Int]) (_b[Knowledge_Index3_mean:Type2] = _b[Knowledge_Index2_mean:Int])
		loc IntNeut = r(chi2)
		loc p_IntNeut = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 14							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 14

					
		mat `M' = (`M' \ `F_stat',`Fp_val')
		//No == Neut
		test (_b[Travel3_mean:Type1] = _b[Travel3_mean:Type2])  (_b[Total_Interactions3_mean:Type1] = _b[Total_Interactions3_mean:Type2])  (_b[Handwash3_mean:Type1] = _b[Handwash3_mean:Type2]) (_b[Mask_Use3_mean:Type1] =_b[Mask_Use3_mean:Type2]  ) ( _b[Conversations3_mean:Type1]=_b[Conversations3_mean:Type2]) (_b[Knowledge_Index3_mean:Type1] = _b[Knowledge_Index3_mean:Type2])
		loc NoNeut = r(chi2)
		loc p_NoNeut = r(p)
		/* compute F-statistic and p-value from chi2 */
					loc df_num = r(df) 										
					loc df_den = `obs' - `df_num' - 1 						
					loc F_stat = round(r(chi2)/r(df), 0.001) in 15							
					loc Fp_val = round(Ftail(`df_num', `df_den',r(chi2)/r(df)), 0.001) in 15


		mat `M' = (`M' \ `F_stat',`Fp_val')
	
	
	restore
}

mat output = Mpooled,Mjio,Mnon_jio  //pool the three result matrices

//Output as Latex table
frmttable using "`path'/output/Tables/TableA7.tex", statmat(output) tex rtitle("SD = Hyg"\"SD = Ext"\"SD = Int"\"SD = No"\"SD = Neut"\"Hyg = Ext"\"Hyg = Int"\"Hyg = No"\"Hyg = Neut"\"Ext = Int"\"Ext = No"\"Ext = Neut"\"Int = No"\"Int = Neut"\"No = Neut") ctitle("","Panel A: Pooled","" ,"Panel B: Jio","" ,"Panel C: Non Jio" \ "Test","F-statistic","p-value","F-statistic","p-value","F-statistic","p-value") sdec(3) vlines(0001010) replace





*=======================================================================================================================================*
					* SUPPLEMENTARY TABLE A11| Differences in Treatment Effects by Message Content (Pooled Sample)*
*=======================================================================================================================================*
clear all
use "`path'/data/outcomes_reg_input.dta", clear 

foreach var in travel_own W2total_interactions_vill typical_handwash resp_mask_wear W2ever_talk net_knowledge { //standardize each variable with its control standard deviation

qui su `var' if Treatment == 0
gen `var'_sd = `var'/r(sd)

}

local controls smartphone resp_age resp_gender  //controls used throughout the regressions
local FE i.district i.id_date i.jio_yn 			//FE used throughout the regressions

foreach var in travel_own W2total_interactions_vill typical_handwash resp_mask_wear W2ever_talk net_knowledge {

		qui reg `var'_sd SD Hyg  `FE' `controls'
		estimates store `var'1

		qui reg `var'_sd Ext Int  `FE' `controls'
		estimates store `var'2

		qui reg `var'_sd Type1 Type2 `FE' `controls'
		estimates store `var'3

}

suest travel_own1 W2total_interactions_vill1 typical_handwash1  resp_mask_wear1 W2ever_talk1 net_knowledge1 ///
 travel_own2 W2total_interactions_vill2 typical_handwash2  resp_mask_wear2 W2ever_talk2 net_knowledge2 ///
 travel_own3 W2total_interactions_vill3 typical_handwash3  resp_mask_wear3 W2ever_talk3 net_knowledge3, vce(cluster pincode)

foreach var in travel_own W2total_interactions_vill typical_handwash resp_mask_wear W2ever_talk net_knowledge {
 

lincom _b[`var'1_mean:SD] - _b[`var'1_mean:Hyg], level(90)
mat `var'_mat = (r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:SD] - _b[`var'2_mean:Ext], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:SD] - _b[`var'2_mean:Int], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:SD] - _b[`var'3_mean:Type1], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:SD] - _b[`var'3_mean:Type2], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:Hyg] - _b[`var'2_mean:Ext], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:Hyg] - _b[`var'2_mean:Int], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:Hyg] - _b[`var'3_mean:Type1], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'1_mean:Hyg] - _b[`var'3_mean:Type2], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'2_mean:Ext] - _b[`var'2_mean:Int], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'2_mean:Ext] - _b[`var'3_mean:Type1], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'2_mean:Ext] - _b[`var'3_mean:Type2], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'2_mean:Int] - _b[`var'3_mean:Type1], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'2_mean:Int] - _b[`var'3_mean:Type2], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))

lincom _b[`var'3_mean:Type1] - _b[`var'3_mean:Type2], level(90)
mat `var'_mat = (`var'_mat \ r(estimate), r(lb), r(ub),r(p))


}

mat output = travel_own_mat,W2total_interactions_vill_mat,typical_handwash_mat,resp_mask_wear_mat,W2ever_talk_mat,net_knowledge_mat

 
frmttable using "`path'/output/Tables/TableA11.tex", statmat(output) tex rtitle("SD - Hyg"\"SD - Ext"\"SD - Int"\"SD - No"\"SD - Neut"\"Hyg - Ext"\"Hyg - Int"\"Hyg - No" ///
 \"Hyg - Neut"\"Ext - Int"\"Ext - No"\"Ext - Neut"\"Int - No"\"Int - Neut"\"No - Neut") ///
 ctitle("", "","","Travel","", "","","Interactions","", "","","Handwash","", "","","Mask Usage","", "","","Conversations","", "","","Knowledge", "" \ ///
 "Test","Estimate", "lower bound", "upper bound", "p-value", "Estimate", "lower bound", "upper bound","p-value", "Estimate", "lower bound", "upper bound","p-value", "Estimate", "lower bound", "upper bound","p-value", ///
 "Estimate", "lower bound", "upper bound", "p-value","Estimate", "lower bound", "upper bound","p-value") sdec(3) vlines(010001000100010001000100) replace
 
 
 
 



*==================================================================================================================================
                    *Supplementary Table A13| Characteristics of Gram Panchayat Members across Jio and Non-Jio Users*
*==================================================================================================================================

preserve 

keep if jio_yn != .

iebaltab resp_age resp_gender smartphone gp_member, grpvar(jio_yn) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Non-Jio @ 1 Jio") ///
savetex("`path'/output/Tables/TableA13.tex") replace


*===================================================================================================================================*
                    *Supplementary Table A14| Balance Table for Gram Panchayat Members Surveyed from May 8-19*
*===================================================================================================================================*

iebaltab resp_age resp_gender jio_yn smartphone gp_member, grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA14.tex") replace

restore




*===================================================================================================================================*
                    *Supplementary Table A15| Balance Table for Gram Panchayat Members over time*
*===================================================================================================================================*

** NOTE: for this table, the day-level balance table are produced as separate .tex files and the merging has to be done ex-post manually **
preserve 

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("09may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may9.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("10may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may10.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("11may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may11.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("12may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may12.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("13may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may13.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("15may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may15.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("18may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may18.tex") replace

iebaltab resp_age resp_gender jio_yn smartphone gp_member if id_date == date("19may2020", "DMY"), grpvar(Treatment) grpcodes rowvarlabels pttest starsnoadd grplabels("0 Control @ 1 Treatment") ///
savetex("`path'/output/Tables/TableA15_may19.tex") replace

restore








 


******************************
*** END **********************
******************************









